<!DOCTYPE html>
<html lang="zh-CN">
	<head>
		<title>{$config['admin_name']}</title>
		<meta name="renderer" content="bew">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<link rel="stylesheet" type="text/css" href="/static/third/layui/css/layui.css">
		<link rel="stylesheet" type="text/css" href="/static/bews/admin_style/admin.css">
		<link rel="stylesheet" type="text/css" href="/static/bews/admin_style/login.css">
		<script type="text/javascript" src="/static/third/layui/layui.js"></script>
	</head>
	<body class="login">
		<div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login">
			<div class="layadmin-user-login-main">
				<div class="layadmin-user-login-box layadmin-user-login-header">
					<img src="{$config['logo']}" style="width:100px;height:100px;margin-bottom:20px;" />
					<h2>{$config['admin_name']}</h2>
				</div>
				<div class="layadmin-user-login-box layadmin-user-login-body layui-form">
					<form class="layui-form login-form">
						<div class="layui-form-item">
							<label class="layadmin-user-login-icon layui-icon layui-icon-username" for="account"></label>
							<input type="text" id="account" name="account" placeholder="邮箱" class="layui-input" value="428188207@qq.com">
						</div>
						<div class="layui-form-item">
							<label class="layadmin-user-login-icon layui-icon layui-icon-password" for="password"></label>
							<input type="password" name="password" class="layui-input" placeholder="密码" class="layui-input" value="123456">
						</div>
						<div class="layui-form-item">
							<div class="layui-row">
								<div class="layui-col-xs7">
									<label class="layadmin-user-login-icon layui-icon layui-icon-vercode" for="code"></label>
									<input type="text" name="code" placeholder="图形验证码" class="layui-input">
								</div>
								<div class="layui-col-xs5">
									<div style="margin-left:10px;">
										<img src="{:captcha_src()}" class="layadmin-user-login-codeimg" id="img" onclick="reloadImg()">
									</div>
								</div>
							</div>
						</div>
						<div class="layui-form-item" style="margin-bottom: 20px;">
							<input type="checkbox" name="remember" lay-skin="primary" title="记住密码">
						</div>
					</form>
					<div class="layui-form-item">
						<button class="layui-btn layui-btn-fluid" onclick="login()">登 陆</button>
					</div>
				</div>
			</div>
		</div>
	</body>
</html>
<script type="text/javascript">
	layui.use(['layer','form'],function(){
		var form = layui.form;
		layer = layui.layer;
		$ = layui.jquery;
		// 用户名控件获取焦点
		$('#account').focus();
		// 回车登录
		$('input').keydown(function(e){
			if(e.keyCode == 13){
				login();
			}
		});
	});
	// 登陆
	function login(){
		$.post("{$config['admin_route']}login/login",$('form').serialize(),function(res){
			if(res.code>0){
				reloadImg();
				layer.msg(res.msg,{'icon':2});
			}else{
				layer.msg(res.msg,{'icon':1});
				setTimeout(function(){window.location.href="{$config['admin_route']}index/index";},1000);
			}
		},'json');
	}
	// 重新生成验证码
	function reloadImg(){
		$('#img').attr('src','{:captcha_src()}?rand='+Math.random());
	}
</script>